<?php
    class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
    {
        protected function _initDatabase(){
            $db = $this->getPluginResource('db')->getDbAdapter();
            $db->query("SET NAMES 'utf8'");
            Zend_Registry::set('db', $db);            
        }
        
        protected function _initAutoload(){
        	$front = Zend_Controller_Front::getInstance();
        	$front->registerPlugin(new Zend_Controller_Plugin_ErrorHandler(array(
        			'module'     => 'error',
        			'controller' => 'error',
        			'action'     => 'error'
        	)));
        	
            $autoloader = new Zend_Application_Module_Autoloader(array(
                'namespace' => '',
                'basePath' => dirname(__FILE__),
            ));
            return $autoloader;
        }
        
        public function _initSession(){
            Zend_Session::start();
            ob_start();
        }
        
        protected function _initFrontController(){
            $acl = new Zendvn_Acl_Acl();
            $front = Zend_Controller_Front::getInstance();
            $front->addModuleDirectory(APPLICATION_PATH."/modules/");
            $front->setDefaultModule('default');
            $front->registerPlugin(new Zendvn_Acl_AclPlugin($acl));
            return $front;
        }
    }
